//
//  MyHistoryProfitCell.m
//  NewPro
//
//  Created by 何荧红 on 2018/10/12.
//  Copyright © 2018 何荧红. All rights reserved.
//

#import "MyHistoryProfitCell.h"

@interface MyHistoryProfitCell ()
@property (nonatomic, strong) UILabel *timelab;
@property (nonatomic, strong) UILabel *moneytitle;
@property (nonatomic, strong) UILabel *submoney;

@end

@implementation MyHistoryProfitCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setSubdic:(NSDictionary *)subdic{
    _subdic = subdic;
    if (_subdic.count > 0) {
        self.timelab.text = _subdic[@"month"];
        self.moneytitle.text = [NSString stringWithFormat:@"%@",_subdic[@"jye"]];
        if ([_subdic[@"sy"] integerValue] >= 0) {
            self.submoney.text = [NSString stringWithFormat:@"+%@",_subdic[@"sy"]];
        }else{
            self.submoney.text = [NSString stringWithFormat:@"%@",_subdic[@"sy"]];
        }
    }
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 49);
        [self CleanMyHistoryProfitView];
    }
    return self;
}
- (void)CleanMyHistoryProfitView{
    self.timelab = [[UILabel alloc]init];
    _timelab.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
    _timelab.textColor = [UIColor colorWithHexString:@"666666"];
    [self addSubview:_timelab];
    [_timelab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.left.equalTo(self.mas_left).offset(14);
    }];
    
    self.moneytitle = [[UILabel alloc]init];
    _moneytitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    _moneytitle.textColor = [UIColor colorWithHexString:@"333333"];
    [self addSubview:_moneytitle];
    [_moneytitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.timelab.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
    
    self.submoney = [[UILabel alloc]init];
    _submoney.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    _submoney.textColor = [UIColor colorWithHexString:@"F86912"];
    [self addSubview:_submoney];
    [_submoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.timelab.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-14);
    }];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
